<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>课程统计总览</title>
	<link rel="stylesheet" type="text/css" href="/static/css/hw-admin.css">
	<link rel="stylesheet" href="/static/css/lb.css"> 
    <style>
        .hw-select .select-options {
            max-height: 100px;
        }
        #imgModal .modal-body {
            overflow-y: visible;
        }
        td,th {
            word-break: break-all;
        }
    </style>
    <!--[if lt IE 9]>
    　 <script src="/static/lib/html5shiv.min.js" type="text/javascript"></script>
       <script src="/static/lib/selectivizr.min.js" type="text/javascript"></script>
    <![endif]-->  
</head>

<body>
        <div class="hw-iframe">
            <div class="hw-header-wrapper">
                <div class="hw-header">
                    <div class="hw-header__item--left">
                        申诉清单
                    </div>
                </div>
            </div>
            <div class="hw-filter-wrapper">
                <div class="hw-filter">
                    <form method="GET" action="<?=$url ?>">
                        <div class="default-filter"> 
                            <div class="hw-input-label"> 
                                <div class="form-control">
                                    <div class="hw-search-prevent">
                                        <input type="text" id="company-name" class="hw-input" placeholder="请输入姓名、身份证号" name="screen" value="<?=isset($_GET['screen']) ? $_GET['screen'] : '' ?>">
                                        <button class="search-btn" type="submit"><i class="iconfont"></i></button>
                                    </div>
                                </div>
                            </div>
                            <input type="hidden" id="state" name="status" value="">
                            <div class="filter-switch" data-status="">更多筛选条件<i style="transform: scale(0.56);" class="iconfont hw-down">&#xe87d;</i><i  style="transform: scale(0.56);" class="iconfont hw-up hide">&#xe87e;</i></div>
                        </div>
                        <div class="filter-detail" style="display: <?=isset($_GET['start_time']) ? 'block' : 'none' ?>">
                            <div class="filter-item">
                                <div class="hw-input-label">
                                    <label class="name" for="">申诉时间</label>
                                    <div class="input-icon-group">
                                        <input type="text" id="startime" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\',{d: -1})||\'%y-%M-{%d-1}\'}'})" placeholder="选择日期" name="start_time" value="<?=isset($_GET['start_time']) ? $_GET['start_time'] : '' ?>">
                                        <div class="icon-wrapper">
                                            <i class="iconfont">&#xe601;</i>
                                        </div>
                                    </div>
                                </div>

                                <div class="hw-input-label">
                                    <label class="name" for="" style="width: 34px;text-align: center;">——</label>
                                    <div class="input-icon-group">
                                        <input type="text" id="endtime" onclick="WdatePicker({minDate:'#F{$dp.$D(\'startime\',{d:1});}',maxDate: '%y-%M-%d'})"  placeholder="选择日期" name="end_time" value="<?=isset($_GET['end_time']) ? $_GET['end_time'] : '' ?>">
                                        <div class="icon-wrapper">
                                            <i class="iconfont">&#xe601;</i>
                                        </div>
                                    </div>
                                </div>
                                <div class="operate-btns">
                                    <div style="float: left;" class="hw-btn hw-default-btn reset_form"><i style="font-size: 13px;position: relative;left: -2px;" class="iconfont">&#xe629;</i>重置</div>
                                    <button class="hw-btn"><i class="iconfont">&#xe9df;</i>查询</button>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" name="type" value="<?=isset($_GET['type']) ? $_GET['type'] : '' ?>">
                    </form>
                </div>
            </div>
            <div class="tab-wrap">
                <ul class="hw-nav-tabs">
                    <a href="<?=base_url().'Admin/Appeal/appealList?type=0' ?>"><li data-toggle="tab" class="<?=isset($_GET['type']) && $_GET['type'] == 1 ? '' : 'active' ?>">证件重复</li></a>
                    <!-- <a href="<?=base_url().'Admin/Appeal/appealList?type=1' ?>"><li data-toggle="tab" class="<?=isset($_GET['type']) && $_GET['type'] == 1 ? 'active' : '' ?>">信息识别错误</li></a> -->
                </ul>
            </div>
            
            <div class="main-table-wrap form-one">
                <form id="table-form-one" method="POST" action="">
                    <table cellspacing="0" cellpadding="0" border="0">  
                        <colgroup>
                            <col class="col-5">
                            <col class="col-12">
                            <col class="col-7">
                            <col class="col-5">
                            <col class="col-5"> 
                            <col class="col-7">
                            <col class="col-6">
                            <col class="col-6">
                            <col class="col-9">
                        </colgroup>

                        <thead>
                            <tr>
                                <th>姓名</th>
                                <th>身份证号</th>
                                <th>联系方式</th>
                                <th>来源</th>
                                <th>凭证照片</th>
                                <th class="hover-th">
                                    <span>
                                        <?php if (isset($_GET['status'])): ?>
                                            <?php switch ($_GET['status']) {
                                                case '0':
                                                    echo '待审核';
                                                    break;

                                                case '1':
                                                    echo '有效';
                                                    break;

                                                case '2':
                                                    echo '驳回';
                                                    break;
                                                
                                                default:
                                                    echo '申诉结果';
                                                    break;
                                            } ?>
                                        <?php else: ?>
                                            待审核
                                        <?php endif ?>
                                        <i class="iconfont"></i>
                                    </span>
                                    <div class="hover-content"> 
                                        <ul class="info" data-target="#state"> 
                                            <li class="list <?=isset($_GET['status']) && $_GET['status'] == '' ? 'active' : '' ?>" data-value="">全部</li>
                                            <li class="list <?=isset($_GET['status']) ? ($_GET['status'] === '0' ? 'active' : '') : 'active' ?>" data-value="0">待审核</li>
                                            <li class="list <?=isset($_GET['status']) && $_GET['status'] === '1' ? 'active' : '' ?>" data-value="1">有效</li>
                                            <li class="list <?=isset($_GET['status']) && $_GET['status'] === '2' ? 'active' : '' ?>" data-value="2">驳回</li>
                                        </ul>
                                    </div>
                                </th>
                                <th>申诉时间</th>
                                <th>处理时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>                     

                        <tbody>
                            <?php foreach ($list as $key => $value): ?>
                                <tr>
                                    <td><?=$value['name'] ?>-申诉人</td>
                                    <td><?=$this->unlock($value['idNumber']) ?></td>
                                    <td><?=$value['phone'] ?></td>
                                    <td><?=$value['origin'] ?></td>
                                    <td>
                                        <span style="cursor: pointer;" class="blue-color" onclick="createPreviewModal('<?=$value['img'] ?>')">凭证</span>
                                    </td>
                                    <td><?=$value['status'] == 0 ? '待审核' : ($value['status'] == 1 ? '有效' : '驳回') ?></td>
                                    <td><?=$value['create_time'] ?></td>
                                    <td><?=$value['handle_time'] ?></td>
                                    <td class="opt">
                                        <?php if ($value['status'] == 0): ?>
                                            <span style="cursor: pointer;" data-id="<?=$value['id'] ?>" class="blue-color have-use"  data-limit="<?=isset($_GET['type']) && $_GET['type'] == 1 ? 2 : 1 ?>"><i class="iconfont">&#xe626;</i>有效</span>
                                            <a class="red-color reject" href="javascript:;" data-id="<?=$value['id'] ?>"><i class="iconfont">&#xe620;</i>驳回</a>
                                        <?php endif ?>
                                    </td>
                                </tr>

                            <?php if ((!isset($_GET['type']) || $_GET['type'] == 0) && $value['status'] == 0): ?>
                                <tr>
                                    <td><?=$value['repeat']['name'] ?></td>
                                    <td><?=$this->unlock($value['repeat']['idNumber']) ?></td>
                                    <td><?=$this->unlock($value['repeat']['phone']) ?></td>
                                    <td><?=$value['repeat']['origin'] ?></td>
                                    <td>
                                        <span style="cursor: pointer;" class="blue-color" onclick="createPreviewModal('<?=$value['repeat']['card_img'] ?>')">凭证</span>
                                    </td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            <?php endif ?>
                            <?php endforeach ?>
                        </tbody>
                    </table>
                </form>
                <?php $this->load->view('Admin/Page/page'); ?>
            </div>

        </div>
        <div class="modal hide" id="imgModal">
            <div class="modal-mask"></div>
            <div class="modal-content"> 
                <div class="modal-header">
                    <i class="iconfont" data-dismiss="modal">&#xe63d;</i>
                    <div class="modal-title">提示</div>
                </div>
                <form action="<?=base_url().'Admin/Appeal/appealReject' ?>" method="post">
                    <input type="hidden" name="id">
                    <div class="modal-body">
                        <div class="group-item">
                            <div class="hw-input-label">
                                <div class="name">驳回理由</div>
                                <div class="form-control">
                                <label class="hw-select"> 
                                        <div class="select-options">
                                            <div class="option selected" data-value="照片拍摄不清晰"><span>照片拍摄不清晰</span><i class="iconfont">&#xe649;</i></div>
                                            <div class="option" data-value="手持身份证照非本人证件"><span>手持身份证照非本人证件</span><i class="iconfont">&#xe649;</i></div>
                                        </div>
                                        <div class="show-option">照片拍摄不清晰</div><i class="iconfont">&#xe619;</i>
                                        <input class="hw-input" value="照片拍摄不清晰" name="property" type="text" readonly="" unselectable="on">
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button class="hw-btn--normal" type="submit" data-dismiss="modal">确定</button>
                        <button class="hw-btn--default" type="button" data-dismiss="modal">取消</button>
                    </div>
                </form>
            </div>
        </div>
    

	<script src="/static/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/static/js/common/util.js"></script>
	<script type="text/javascript" src="/static/js/common/upload.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.validate.js"></script>
	<script type="text/javascript" src="/static/lib/messages_zh.js"></script>
	<script type="text/javascript" src="/static/js/common/validateExtend.js"></script>
	<script type="text/javascript" src="/static/js/common/common.js"></script>
    <!-- <script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/addCustomizeDialog.js"></script> -->
    <script>
        var baseUrl = '<?=base_url()?>';
        console.log(baseUrl)
        var imgModal = $('#img-modal');
        function createPreviewModal(url) {
        if(!url||url==''){
            return;
        }
        var str;
		if (imgModal.length > 0) {
			imgModal.find('.modal-body').find('img').attr('src', url);
			imgModal.removeClass('hide');
			return;
		} 

		str = '<div class="modal hide" id="img-modal">'+
				    '<div class="modal-mask"></div>'+
				    '<div class="modal-content">'+
				        '<div class="modal-header">'+
				            '<i class="iconfont" data-dismiss="modal">&#xe63d;</i>'+
				            '<div class="modal-title">图片预览</div>'+
				        '</div>'+
				        '<div class="modal-body">'+
				        	'<img class="preview-img-box" src="'+ url +'">'+
				        '</div>'+ 
				    '</div>'+
				'</div>';
		$('body').append(str);
		setTimeout(function() {
			imgModal = $('#img-modal');
			imgModal.removeClass('hide');
		}, 20);
    }
    
    $('.reject').on('click',function(){
       
        $('#imgModal').removeClass('hide');
        var dataId = $(this).data('id');
        $('input[name=id]').val(dataId);

    })
    $('.have-use').on('click',function(){
        var dataId = $(this).data('id');
        $.confirm({
            msg: '是否确认该申诉有效？',
            confirm: function(){
                window.location.href = baseUrl + `Admin/Appeal/appealAgree/${dataId}`;
                // var dataLimit = $(this).data('limit');
                // var dataId = $(this).data('id');
                // if(dataLimit==2){
                //     $.post('/Admin/Appeal/checkIdNumber',{id: dataId},function(info){
                //         info = JSON.parse(info);
                //         console.log(info);
                //         if(info.code==1){
                //             window.location.href = baseUrl + `Admin/Appeal/appealAgree/${dataId}`;
                //             // console.log(baseUrl + `Admin/Appeal/appealAgree/${dataId}`);
                //         }else {
                //             $.confirm({
                //                 msg: '身份证已经被绑定，是否解绑？',
                //                 confirm: function(){
                //                     window.location.href = baseUrl + `Admin/Appeal/appealAgree/${dataId}`;
                //                 }
                //             })
                //         }
                //     })
                // } else {
                //     window.location.href = baseUrl + `Admin/Appeal/appealAgree/${dataId}`;
                // }
            }
        })
    })
    </script>
</body>
</html>
